package com.newblog.common;

import lombok.Data;

/**
 * Created with Intellij IDEA.
 * Description;
 * UserInfo:TQ02
 * Data:2023-12-10
 * Time:15:44
 * Text：统一对象
 */
@Data
public class ResultAjax {
    private int code;
    private String msg;
    private Object data;
    public static ResultAjax succ(Object data){
        ResultAjax result =new ResultAjax();
        result.setCode(200);
        result.setMsg("");
        result.setData(data);
        return result;
    }
    public static ResultAjax succ(int code,String msg,Object data){
        ResultAjax result =new ResultAjax();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
    public static ResultAjax fail(int code,String msg){
        ResultAjax result =new ResultAjax();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(null);
        return result;
    }
    public static ResultAjax fail(int code,String msg,Object data){
        ResultAjax result =new ResultAjax();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
}
